package com.gaussian.property.module.biz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gaussian.property.module.biz.entity.ProjectMonitor;
import com.gaussian.property.module.biz.mapper.ProjectMonitorMapper;
import com.gaussian.property.module.biz.service.IProjectMonitorService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.songqi.common.core.constant.Constants;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 项目的监控 服务实现类
 * </p>
 *
 * @author songqi(13776346982)
 * @since 2024-09-29
 */
@Service
public class ProjectMonitorServiceImpl extends ServiceImpl<ProjectMonitorMapper, ProjectMonitor> implements IProjectMonitorService {


    @Override
    public boolean isProjectEnableMonitor(String projectId) {
        LambdaQueryWrapper<ProjectMonitor> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ProjectMonitor::getProjectId, projectId);
        queryWrapper.eq(ProjectMonitor::getEnableStatus, Constants.YES);
        return super.count(queryWrapper) > 0;
    }
}
